extends Node2D

@onready var hurt_box: HurtBox = $HurtBox
#@onready var area_2d: Area2D = $Area2D
#const GRASS_EFFECT = preload("res://sences/grass_effect.tscn")
@export var GRASS_EFFECT: PackedScene

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	hurt_box.hurt.connect(_on_hurt)


func _on_hurt(other_area: Area2D) -> void:
	var grassEffect = GRASS_EFFECT.instantiate()
	get_tree().current_scene.add_child(grassEffect)
	grassEffect.global_position = global_position
	queue_free()
	
